package kr.pe.johnkim.pushchat.mobile.service;

import kr.pe.johnkim.pushchat.mobile.dao.PushChatFriendDao;
import kr.pe.johnkim.pushchat.mobile.domain.PushChatFriend;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 6. 26.
 */
@Service
public class PushChatFriendServiceImpl implements PushChatFriendService {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(PushChatFriendServiceImpl.class);

    @Autowired
    private PushChatFriendDao pushChatFriendDao;

    /**
     * 친구 중복 확인을 한다.
     *
     * @param pushChatFriend
     * @return
     */
    @Override
    public PushChatFriend selectDuplicationFriend(PushChatFriend pushChatFriend) {
        logger.info("selectDuplicationFriend");
        return this.pushChatFriendDao.selectDuplicationFriend(pushChatFriend);
    }

    /**
     * 친구를 등록 한다.
     *
     * @param pushChatFriend
     */
    @Override
    public void registerFriend(PushChatFriend pushChatFriend) {
        logger.info("registerFriend");
        this.pushChatFriendDao.registerFriend(pushChatFriend);
    }

    /**
     * 친구를 비활성화 한다.
     *
     * @param pushChatFriend
     */
    @Override
    public void updateDeactivateFriend(PushChatFriend pushChatFriend) {
        logger.info("updateDeactivateFriend");
        this.pushChatFriendDao.updateDeactivateFriend(pushChatFriend);
    }

    /**
     * 친구 목록을 가져 온다.
     *
     * @param pushChatFriend
     * @return
     */
    @Override
    public List<PushChatFriend> selectFriendList(PushChatFriend pushChatFriend) {
        logger.info("selectFriendList");
        return this.pushChatFriendDao.selectFriendList(pushChatFriend);
    }
}
